
let nums = [1,-1,5,-2,3];
var returnToBoundaryCount = function(nums) {
    let count = 0;
    let add = 0;
    for(let i=0;i<nums.length;i++){
        count = count + nums[i];
        if(count == 0){
            add++
        }
    }
    return add;
};
console.log(returnToBoundaryCount(nums));
